package basic;

public class ExtendsExercise {
    public static void main(String[] args) {
        Student st = new Student("alan", 1, 2);
        System.out.println(st);
        System.out.println(st.name);
        System.out.println(st.hello());
        PrimaryStudent ps = new PrimaryStudent("wzy", 4, 100, 2);
        System.out.println(ps.hello());
    }
}
class PrimaryStudent extends Student{
    private int grade;

    public PrimaryStudent(String name, int age, int score, int grade) {
        super(name, age, score);
        this.grade = grade;
    }

    @Override
    public String hello(){
        return "aaa";
    }
}

class Student extends Person{

    public String hello(){
        return "Hello, " + name;
    }

    private int score;

    public Student(String name, int age, int score) {
        super(name, age);
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name=" + getName() +
                ", age=" + age +
                ", score=" + score +
                '}';
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }


}
